home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Iff_Animation.AMOS / Iff_Animation.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  6.4 KB  |  182 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         *               Iff Anim     (line  24) 
  4. '*      IFF ANIMATION      *               Frame Load    (line  41)    
  5. '*                         *               Frame Length  (line  71)    
  6. '* (c) Europress Software  *               Frame Play    (line  85)    
  7. '*                         *               Frame Skip    (line 102)    
  8. '*     Ronnie Simpson      *               Frame Param   (line 112)    
  9. '*************************** 
  10. '
  11. '
  12. '------------------------------------------- 
  13. 'GENERAL 
  14. '------------------------------------------- 
  15. 'AMOS Professional uses animations compressed in Mode 5 (the default setting 
  16. 'Of Deluxe Paint). The first frame of your animation contains the background 
  17. 'details against which all other frames are tested and only the changes are
  18. 'stored. 
  19. 'Sequences can only be played forwards although commands are included which
  20. 'allow certain frames to be skipped. 
  21. 'Because of the efficiency of the AMOS Pro. routines each frame may have to
  22. 'be slowed down to keep the same speed as the development package. (1/50th.
  23. '(of a second per frame for D/Paint anims for example) 
  24. '
  25. '------------------------------------------- 
  26. 'Iff Anim
  27. '------------------------------------------- 
  28. 'play an animation file
  29. '
  30. 'This is the easiest way of playing a complete animation from start to finish. 
  31. '
  32. '                         +--->file name to be loaded
  33. '                         |     +--->screen number 
  34. '                         |     | +--->optional number of times
  35. '                Iff Anim F$ To 0,2
  36. '
  37. 'If the number of times parameter is ommited the sequence will only be 
  38. 'played once.
  39. 'If the destination screen already exists then it will be overwritten. 
  40. 'When animation is complete memory is released back to the system. 
  41. '
  42. '------------------------------------------- 
  43. 'Frame Load  
  44. '------------------------------------------- 
  45. 'load animation frames to memory 
  46. '
  47. '                +--->=number of frames loaded 
  48. '                |             +--->channel number 
  49. '                |             |    +--->bank number 
  50. '                N=Frame Load (1 to 6)   
  51. '
  52. 'In its simplest form (as above) the Frame Load function loads the first   
  53. 'frame of an anim. file into the specified bank number, the bank will be 
  54. 'reserved automatically in fast memory.
  55. 'An optional number of frames number may be added which will load this number  
  56. 'of frames to a bank, if this number is equal to or greater than the total 
  57. 'number of frames in the anim. then all frames will be loaded:-
  58. '
  59. '          N=Frame Load (1 to 6,999)    (load all frames to bank 6)  
  60. '
  61. 'Upon completion of the loading 'N' would contain the actual number of frames
  62. 'loaded and no error would be generated by use of the over-large number of 
  63. 'frames parameter. 
  64. '
  65. 'Another version of this function loads your anim. directly to an address in 
  66. 'memory, in this case it is best to find the size of memory required with the
  67. 'Frame Length function (see below) to avoid over-running your reserved memory  
  68. 'area and crashing the system. 
  69. '
  70. '       N=Frame Load (1 to X,999)    (Where X=the memory start address)  
  71. '
  72. '------------------------------------------- 
  73. 'Frame Length  
  74. '------------------------------------------- 
  75. 'return the length of selected frames
  76. '
  77. '                        +--->=channel number  
  78. '                        | +--->number of frames to be calculated
  79. '                        | | 
  80. '          L=Frame Load (1,6)    
  81. '
  82. 'If the number of frames parameter is omitted then only the first frame is   
  83. 'calculated and once again an over-large number may be used to calculate all 
  84. 'frames, the value returned is the total number of bytes.
  85. '
  86. '------------------------------------------- 
  87. 'Frame Play  
  88. '------------------------------------------- 
  89. 'play a loaded animation 
  90. '
  91. '                              +--->=Bank number 
  92. '                              |  +--->number of frames
  93. '                              |  | +--->destination screen number 
  94. '                F=Frame Play (6,20,1)   
  95. '
  96. 'If the screen number parameter is ommited then the anim. will try to play 
  97. 'to the current screen, note that double buffering will not be automatically 
  98. 'set up. 
  99. 'The total number of frames loaded can be found in the value returned by the 
  100. 'Frame Load function.    
  101. 'The Bank number may be replaced by the start address in memory of the anim. 
  102. '
  103. '------------------------------------------- 
  104. 'Frame Skip  
  105. '------------------------------------------- 
  106. 'miss an animation frame 
  107. '
  108. 'Form skip is identical to Frame Play except that no output is made to   
  109. 'the screen  
  110. '
  111. 'eg.            S=Frame Skip (6,2)  (Skip 2 frames from anim. in bank 6)   
  112. '
  113. '------------------------------------------- 
  114. 'Frame Param     
  115. '------------------------------------------- 
  116. 'return playing time of animation
  117. '
  118. 'This instruction is used after Frame Play or Frame Skip to delay the program  
  119. 'until the screen is totally refreshed.
  120. 'Value returned is in 1/50ths. of a second.
  121. '
  122. 'eg.       Wait Frame Param    
  123. '------------------------------------------- 
  124. 'EXAMPLE 
  125. '------------------------------------------- 
  126. '
  127. Screen Open 0,640,200,4,Hires : Flash Off : Curs Off 
  128. Palette 4,$FF : Cls 0 : Pen 1 : Paper 0 : Hide 
  129. Locate 0,12 : Centre "Please wait..." : Wait Vbl 
  130. '
  131. Rem *** load the animation into bank 10 and print details
  132. '
  133. Open In 1,"AMOSPro_Tutorial:IFF_Anim/AMOS.Anim"
  134. MEMORY=Frame Length(1,999)
  135. NOF=Frame Load(1 To 10,999)
  136. Fade 2,4,4 : Wait 30 : Cls 0
  137. Locate 0,5 : Centre "Total number of frames="+Str$(NOF)
  138. Locate 0,7 : Centre "Total length in bytes="+Str$(MEMORY)
  139. Locate 0,20 : Centre "Press any mouse key to see the Animation"
  140. Fade 2,4,$FF
  141. Repeat : Until Mouse Key
  142. Close 1
  143. '
  144. Rem *** The easiest way to play this animation would be to use the Iff Anim
  145. Rem *** command but the following should give an insight on how to display 
  146. Rem *** single frames and custom anims.
  147. '
  148. 'For TIMES=1 To 5
  149. '
  150. Rem *** display the first frame from bank number 10 on screen number 0 
  151. FLAG=Frame Play(10,1,0)
  152. '
  153. Rem *** double buffer the screen 
  154. '
  155. Double Buffer 
  156. '  
  157. Rem *** start the loop to show the rest of the frames
  158. '
  159. For X=2 To NOF
  160.    '
  161.    Rem *** load the next frame to the logical screen
  162.    '
  163.    FLAG=Frame Play(FLAG,1)
  164.    '
  165.    Rem *** swap the logical and physical screens
  166.    '
  167.    Screen Swap 
  168.    '
  169.    Rem *** make sure the screen has time to be re-drawn 
  170.    '
  171.    Wait Frame Param+1
  172.  
  173.    '
  174.    Rem *** ready for next frame 
  175.    '
  176. Next X
  177. '
  178. Rem *** repeat the full animation another 4 times
  179. '
  180. ''Next TIMES 
  181. '
  182. Edit